package com.gac.basedownload.inner;

import com.gac.basedownload.model.DownloadConfig;
import com.litesuits.orm.LiteOrm;

public class LiteOrmHelper {

    private static final String DB_NAME = "ad.db";

    private static volatile LiteOrm sInstance;

    private LiteOrmHelper() {
        // Avoid direct instantiate
    }

    public static LiteOrm getInstance() {
        if (sInstance == null) {
            synchronized (LiteOrmHelper.class) {
                if (sInstance == null) {
                    sInstance = LiteOrm.newCascadeInstance(DownloadConfig.context, DB_NAME);
                    sInstance.setDebugged(true);
                }
            }
        }
        return sInstance;
    }

    public static void exitOrm(){
        sInstance = null;
    }
}
